﻿using System;

using Confluent.Kafka;

using RpcClient.Kafka;
using RpcClient.Kafka.Interface;
using RpcClient.Queue.Model;

namespace RpcClient.Interface
{
    public interface IKafkaService
    {
        bool IsInit { get; }
        bool Producer(string msg, KafkaPropertys propertys, params string[] topic);
        bool Producer(string msg, params string[] topic);
        bool Producer<Key, T>(T msg, Key key, KafkaPropertys propertys, params string[] topic) where T : class;
        bool Producer<Key, T>(T msg, Key key, params string[] topic) where T : class;
        bool Producer<Key>(string msg, Key key, KafkaPropertys propertys, params string[] topic);
        bool Producer<Key>(string msg, Key key, params string[] topic);
        bool Producer<T>(T msg, KafkaPropertys propertys, params string[] topic) where T : class;
        bool Producer<T>(T msg, params string[] topic) where T : class;
        IkafkaTransaction ProducerTran(KafkaPropertys propertys);
        IkafkaTransaction<Key> ProducerTran<Key>(KafkaPropertys propertys);

        IKafkaConsumer Subscrib<Key, T>(KafkaSubConfig config, Action<IKafkaEvent<Key, T>> action) where T : class;
        IKafkaConsumer Subscrib<Key, T>(Action<IKafkaEvent<Key, T>> action) where T : class;

        IKafkaConsumer Subscrib<T>(KafkaSubConfig config, Action<IKafkaEvent<Ignore, T>> action) where T : class;
        IKafkaConsumer Subscrib<T>(Action<IKafkaEvent<Ignore, T>> action) where T : class;
    }
}